/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/


import API from './utils/api';
import { TypeScriptServerPlugin } from './utils/plugins';
import { TypeScriptServiceConfiguration } from './utils/configuration';

export interface ITypeScriptServiceClientHost {
	syntaxDiagnosticsReceived(event: any): void;
	semanticDiagnosticsReceived(event: any): void;
	configFileDiagnosticsReceived(event: any): void;
	populateService(): void;
}


export interface ITypeScriptServiceClient {
	normalizePath(resource: any): string | null;
	asUrl(filepath: string): any;
	getWorkspaceRootForResource(resource: any): string | undefined;

	onTsServerStarted: any;
	onProjectLanguageServiceStateChanged: any;
	onDidBeginInstallTypings: any;
	onDidEndInstallTypings: any;
	onTypesInstallerInitializationFailed: any;

	apiVersion: API;
	plugins: TypeScriptServerPlugin[];
	configuration: TypeScriptServiceConfiguration;

	execute(command: 'configure', args: any, token?: any): Promise<any>;
	execute(command: 'open', args: any, expectedResult: boolean, token?: any): Promise<any>;
	execute(command: 'close', args: any, expectedResult: boolean, token?: any): Promise<any>;
	execute(command: 'change', args: any, expectedResult: boolean, token?: any): Promise<any>;
	execute(command: 'geterr', args: any, expectedResult: boolean, token?: any): Promise<any>;
	execute(command: 'quickinfo', args: any, token?: any): Promise<any>;
	execute(command: 'completions', args: any, token?: any): Promise<any>;
	execute(command: 'completionEntryDetails', args: any, token?: any): Promise<any>;
	execute(command: 'signatureHelp', args: any, token?: any): Promise<any>;
	execute(command: 'definition', args: any, token?: any): Promise<any>;
	execute(command: 'implementation', args: any, token?: any): Promise<any>;
	execute(command: 'typeDefinition', args: any, token?: any): Promise<any>;
	execute(command: 'references', args: any, token?: any): Promise<any>;
	execute(command: 'navto', args: any, token?: any): Promise<any>;
	execute(command: 'navbar', args: any, token?: any): Promise<any>;
	execute(command: 'format', args: any, token?: any): Promise<any>;
	execute(command: 'formatonkey', args: any, token?: any): Promise<any>;
	execute(command: 'rename', args: any, token?: any): Promise<any>;
	execute(command: 'occurrences', args: any, token?: any): Promise<any>;
	execute(command: 'projectInfo', args: any, token?: any): Promise<any>;
	execute(command: 'reloadProjects', args: any, expectedResult: boolean, token?: any): Promise<any>;
	execute(command: 'reload', args: any, expectedResult: boolean, token?: any): Promise<any>;
	execute(command: 'compilerOptionsForInferredProjects', args: any, token?: any): Promise<any>;
	execute(command: 'navtree', args: any, token?: any): Promise<any>;
	execute(command: 'getCodeFixes', args: any, token?: any): Promise<any>;
	execute(command: 'getSupportedCodeFixes', args: null, token?: any): Promise<any>;
	execute(command: 'getCombinedCodeFix', args: any, token?: any): Promise<any>;
	execute(command: 'docCommentTemplate', args: any, token?: any): Promise<any>;
	execute(command: 'getApplicableRefactors', args: any, token?: any): Promise<any>;
	execute(command: 'getEditsForRefactor', args: any, token?: any): Promise<any>;
	execute(command: 'applyCodeActionCommand', args: any, token?: any): Promise<any>;
	// execute(command: 'compileOnSaveAffectedFileList', args: any, token?: any): Promise<any>;
	// execute(command: 'compileOnSaveEmitFile', args: any, token?: any): Promise<any>;
	execute(command: string, args: any, expectedResult: boolean | any, token?: any): Promise<any>;
}